<template>
    <div>
      <el-breadcrumb>
        <el-breadcrumb-item :to="{ path:'/manage' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>订单管理</el-breadcrumb-item>
        <el-breadcrumb-item>所有订单</el-breadcrumb-item>
      </el-breadcrumb>
      <el-card shadow="never" :body-style="{padding: '10px'}" class="top">
        <ul>
          <li>用户</li>
          <li>商品</li>
          <li>金额</li>
          <li>数量</li>
          <li>商品操作</li>
          <li>地区/提货方式</li>
          <li>物流相关</li>
          <li>交易操作</li>
        </ul>
      </el-card>
      <div class="orders">
        <el-card shadow="hover" :body-style="{padding: '0'}">
          <div class="header">
            <span>2018-06-28 订单号：00001</span>
            <span class="shop_name">古致堂</span>
            <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
          </div>
          <div class="bottom">
            <ul>
              <li>
                <div class="user">
                  <div class="profile"><router-link :to="{ path: '/manage/userManage', query: {id: 1} }"><img src="../../assets/profile.jpg" alt="profile" width="50px" height="50px"></router-link></div>
                  <div class="message">
                    <p>微信号：韩香茶具</p>
                    <p>姓名：刘慧</p>
                    <p>联系方式：15811117580</p>
                  </div>
                </div>
              </li>
              <li>
                <p>复古茶具一套</p>
                <p>颜色分类：常规版</p>
                <p>货号：001</p>
              </li>
              <li class="money">
                <p>￥1000</p>
                <p>￥800</p>
              </li>
              <li class="num"><p>5</p></li>
              <li class="state"><p><el-tag type="success" size="small">已付款</el-tag></p></li>
              <li class="area">
                <p>北京西城</p>
                <p>店内自提</p>
              </li>
              <li class="log">
                <p>圆通</p>
                <p>编号：165815871498115</p>
              </li>
              <li class="button"><el-button type="primary">订单处理</el-button></li>
            </ul>
          </div>
        </el-card>
        <el-card shadow="hover" :body-style="{padding: '0'}">
          <div class="header">
            <span>2018-06-28 订单号：00001</span>
            <span class="shop_name">古致堂</span>
            <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
          </div>
          <div class="bottom">
            <ul>
              <li>
                <div class="user">
                  <div class="profile"><router-link :to="{ path: '/manage/userManage', query: {id: 2} }"><img src="../../assets/profile.jpg" alt="profile" width="50px" height="50px"></router-link></div>
                  <div class="message">
                    <p>微信号：韩香茶具</p>
                    <p>姓名：刘慧</p>
                    <p>联系方式：15811117580</p>
                  </div>
                </div>
              </li>
              <li>
                <p>复古茶具一套</p>
                <p>颜色分类：常规版</p>
                <p>货号：001</p>
              </li>
              <li class="money">
                <p>￥1000</p>
                <p>￥800</p>
              </li>
              <li class="num"><p>5</p></li>
              <li class="state"><p><el-tag type="danger" size="small">部分发货</el-tag></p></li>
              <li class="area">
                <p>北京西城</p>
                <p>店内自提</p>
              </li>
              <li class="log">
                <p>圆通</p>
                <p>编号：165815871498115</p>
              </li>
              <li class="button"><el-button type="primary">订单处理</el-button></li>
            </ul>
            <div style="margin-top: 10px;">
              <el-collapse v-model="activeNames">
                <el-collapse-item name="1">
                  <template slot="title">
                    <span style="padding: 10px;">发货详情</span>
                  </template>
                  <el-table
                    :data="tableData"
                    style="width: 100%">
                    <el-table-column
                      prop="date"
                      label="日期"
                      sortable
                      width="180"
                      :filters="[{text: '2016-05-01', value: '2016-05-01'}, {text: '2016-05-02', value: '2016-05-02'}, {text: '2016-05-03', value: '2016-05-03'}, {text: '2016-05-04', value: '2016-05-04'}]"
                      :filter-method="filterHandler"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="name"
                      label="姓名"
                      width="180">
                    </el-table-column>
                    <el-table-column
                      prop="address"
                      label="地址"
                      :formatter="formatter">
                    </el-table-column>
                    <el-table-column
                      prop="tag"
                      label="标签"
                      width="100"
                      :filters="[{ text: '家', value: '家' }, { text: '公司', value: '公司' }]"
                      :filter-method="filterTag"
                      filter-placement="bottom-end">
                      <template slot-scope="scope">
                        <el-tag
                          :type="scope.row.tag === '家' ? 'primary' : 'success'"
                          disable-transitions>{{scope.row.tag}}</el-tag>
                      </template>
                    </el-table-column>
                  </el-table>
                </el-collapse-item>
              </el-collapse>
            </div>
          </div>
        </el-card>
      </div>
    </div>
</template>

<script>
export default {
  name: 'order',
  data () {
    return {
      activeNames: [],
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄',
        tag: '家'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄',
        tag: '公司'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄',
        tag: '家'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄',
        tag: '公司'
      }]
    }
  },
  methods: {
    formatter (row, column) {
      return row.address
    },
    filterTag (value, row) {
      return row.tag === value
    },
    filterHandler (value, row, column) {
      const property = column['property']
      return row[property] === value
    }
  }
}
</script>

<style scoped>
li{
  list-style: none;
}
.top ul, .bottom ul{
   overflow: hidden;
}
.top li{
  float: left;
  line-height: 20px;
  text-align: center;
  width: 100px;
  font-size: 14px;
}
.top li:first-child{
  width: 240px;
}
.top li:nth-child(4){
  width: 50px;
}
.top li:nth-child(7){
  width: 200px;
}
.top li:nth-child(8){
  margin-left: 50px;
}
.orders .el-card{
  margin-top: 20px;
}
.header{
  font-size: 12px;
  border-bottom: 1px solid #ebeef5;
  padding: 10px;
  background-color: rgb(250,250,250);
  color: #606266;
}
.shop_name{
  margin-left: 150px;
}
.bottom{
  padding: 10px;
}
  .bottom li{
    float: left;
    overflow: hidden;
  }
  .bottom li>p{
    font-size: 12px;
    line-height: 18px;
    text-align: center;
  }
  .user{
    overflow: hidden;
    width: 240px;
  }
  .user .profile{
    width: 50px;
    height: 50px;
    overflow: hidden;
    border-radius: 100%;
    float: left;
  }
  .user .message{
    float: left;
    font-size: 12px;
    color: rgb(136,136,136);
    margin-left: 10px;
  }
  .money{
    width: 100px;
  }
  .money p:first-child{
    text-decoration: line-through;
    color: rgb(136,136,136);
  }
  .num{
    width: 50px;
  }
  .state, .area{
    width: 100px;
  }
  .log{
    width: 200px;
  }
  .button{
    margin-left: 50px;
  }
</style>
